export default {
   fetchGet(url) {
    return new Promise((resolve, reject) => {
      fetch(url).then(response => response.json()).then(data => resolve(data)).catch(error => reject(error));
    });
  },
  fetchPost(url, data) {
    return new Promise((resolve, reject) => {
      fetch(url, { method: 'POST', headers: {'Content-Type': 'application/json'},body: JSON.stringify(data)})
      .then(response => response.json()).then(data => resolve(data)).catch(error => reject(error));
    });
  },
  getQuery(params){
    return new URLSearchParams(Object.entries(params)).toString();
  },
}